<nz-layout class="layout">
	<!-- JustFresh 2018-11-28 Begin 引入统一顶部导航 -->
	<app-admin-header></app-admin-header>
	<!-- JustFresh 2018-11-28 End 引入统一顶部导航 -->
	<nz-content class="body">
		<!-- JustFresh 2018-11-28 Begin 面包屑导航 -->
		<nz-breadcrumb>
			<nz-breadcrumb-item><a [routerLink]="['/admin/index']" [queryParams]="{module:'index',opt:'index'}">控制台</a></nz-breadcrumb-item>
			<nz-breadcrumb-item>栏目管理</nz-breadcrumb-item>
    </nz-breadcrumb>
		<!-- JustFresh 2018-11-28 End 面包屑导航 -->
		<!-- JustFresh 2018-11-28 Begin 页面主体部分 -->
		<nz-layout class="main">
			<!-- JustFresh 2018-11-28 Begin 引入左侧导航菜单 -->
			<nz-sider [nzWidth]="200">
				<app-admin-left-nav class="left-nav"></app-admin-left-nav>
			</nz-sider>
			<!-- JustFresh 2018-11-28 Ends 引入左侧导航菜单 -->
			<nz-content class="content">
				<!-- JustFresh 2018-12-04 Begin 分页条件查询表单部分 -->
				<div class="conditions">
					<form class="horizontal">
						<div class="form-group">
							<label>栏目名：</label>
							<input type="" class="form-ipt" [(ngModel)]="channelName" name="channelName" placeholder="请输入栏目名">
						</div>
						<div class="form-group">
							<label>新窗口：</label>
							<select class="form-select" [(ngModel)]="isBlank" name="isBlank">
								<option value="">--请选择</option>
								<option value="1">是</option>
								<option value="0">否</option>
							</select>
						</div>
						<div class="form-group">
							<label>状态：</label>
							<select class="form-select" [(ngModel)]="status" name="status">
								<option value="">--请选择</option>
								<option value="1">启用</option>
								<option value="0">禁用</option>
							</select>
						</div>
						<div class="form-group">
							<a class="btn" (click)="searchData()"><i nz-icon type="search"></i> 搜索</a>
						</div>
						<div class="clearfix"></div>
					</form>
				</div>
				<!-- JustFresh 2018-12-04 End 分页条件查询表单部分 -->
				<!-- JustFresh 2018-12-04 Begin 分页表格数据部分 -->
				<div class="datagrid">
					<div class="title">
						<h4 class="pull-left"><i nz-icon type="user"></i> 栏目数据列表</h4>
						<div class="opts pull-right">
							<button nz-button nzType="default" (click)="importExcel()"><i nz-icon type="file-excel"></i>导出当前页</button>
							<button nz-button nzType="primary" [routerLink]="['/admin/channel/add']" [queryParams]="{module:'index',opt:'channel'}"><i nz-icon type="plus"></i>添加栏目</button>
						</div>
						<div class="clearfix"></div>
					</div>
					<nz-table id="channelTable" #nzTable nzBordered [nzData]="dataSet" nzSize="small">
					  <thead>
						<tr>
						  <th>栏目名称</th>
						  <th>链接</th>
							<th width="90px">排序</th>
							<th width="90px">新窗口</th>
							<th width="90px">状态</th>
							<th width="160px">添加时间</th>
						  <th width="180px">操作</th>
						</tr>
					  </thead>
					  <tbody>
						<ng-template ngFor let-data [ngForOf]="dataSet">
						  <ng-template ngFor let-item [ngForOf]="expandDataCache[data.id]">
							<tr *ngIf="(item.parent&&item.parent.expand)||!(item.parent)">
							  <td [nzIndentSize]="item.level*20" [nzShowExpand]="!!item.children" [(nzExpand)]="item.expand" (nzExpandChange)="collapse(expandDataCache[dataSet.id],item,$event)">
								{{item.channelName}}
							  </td>
								<td>{{item.uri}}</td>
							  <td>{{item.reorder}}</td>
							  <td>
									<nz-tag *ngIf="item.isBlank" [nzColor]="'#87d068'">是</nz-tag>
									<nz-tag *ngIf="!item.isBlank" [nzColor]="'#f50'">否</nz-tag>
								</td>
								<td>
									<nz-tag *ngIf="item.status==1" [nzColor]="'#87d068'">启用</nz-tag>
									<nz-tag *ngIf="item.status==0" [nzColor]="'#f50'">禁用</nz-tag>
								</td>
								<td>{{item.createTime | date:"yyyy-MM-dd HH:mm"}}</td>
							  <td>
							  	<!-- <button (click)="delete()" class="default">查看</button> -->
							  	<button [routerLink]="['/admin/channel/edit',item.id]" [queryParams]="{module:'index',opt:'channel'}" class="primary">编辑</button>
							  	<button (click)="delete(item)" class="danger">删除</button>
							  </td>
							</tr>
						  </ng-template>
						</ng-template>
					  </tbody>
					</nz-table>
				</div>
				<!-- JustFresh 2018-12-04 End 分页表格数据部分 -->
			</nz-content>
		</nz-layout>
		<!-- JustFresh 2018-11-28 End 页面主体部分 -->
		<!-- JustFresh 2018-11-28 Begin 引入统一底部导航 -->
		<app-admin-footer></app-admin-footer>
		<!-- JustFresh 2018-11-28 End 引入统一底部导航 -->
	</nz-content>
</nz-layout>